<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
session_start();
class Data extends CI_Controller {

	function __construct()
	{
		parent::__construct();
		$this->load->library("soap");
		$this->load->library('session');
		$this->load->helper('url');
		$this->load->library('pagination');
		$this->load->helper(array('form', 'url'));
		$this->load->library('upload');
		@session_start();
	}
	
	public function index($type=null)
	{
		 echo mime_content_type('C:\\Users\\ThinkPad\\Desktop\\test.apk');  
		 die();
		$data['data'] = "";
		$this->load->model('service_model'); 
		if($type=="iphone"){
			$cuphap = $this->service_model->get_servicesrandom(1); 
			foreach($cuphap as $value){
				$data['data'] = $value->prefix_1.' '.rand(1,100).','.$value->shortcode;
			}
			 
		}else if($type=="android"){
			$cuphap = $this->service_model->get_servicesrandom(2); 
			foreach($cuphap as $value){
				$data['data'] = $value->prefix_1.' '.rand(1,100).','.$value->shortcode;
			}
		}else if($type=="j2me"){
			$cuphap = $this->service_model->get_servicesrandom(3); 
			foreach($cuphap as $value){
				$data['data'] = $value->prefix_1.' '.rand(1,100).','.$value->shortcode;
			}
		}else{
			$data['data'] = "";
		}
		$this->load->view('portal/data',$data);
	}

	// Xu ly Json lay du lieu tu app ------------Liet ke danh sach---------------
	public function blogradio($type=null,$cate=null){
		$this->load->model('content_model');
		$response = array();
		$response["items"] = array();
		$lists = $this->content_model->showallcontent_catetype($type,$cate); 
		foreach($lists as $value){
				$item = array();
				$item['id']=$value->id;
    			$item['namecontent']=$value->namecontent;
    			$item['description']=$value->description;
    			$item['images']=$value->images;
				$item['coins'] =$value->coins;
				array_push($response["items"], $item);
			
		}
		 $response["success"] = 1;
		echo json_encode($response);
	}
	
	
}